package com.leo.base_project.entity;

import com.leo.base_project.Utils.UIUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

import java.util.Date;

/*
 * 类名：BluDevice
 * 功能：保存蓝牙设备的相关信息
 * 创建时间: 2021/8/25 15:42
 * 创建者：Leo
 */
@Entity
public class BluDevice {
    @Id(autoincrement = true)
    Long id;
    // 设备名
    String device_name;
    // 设备地址
    String device_address;
    // 上次上线时间
    Date onlineTime;
    // 上次下线时间
    Date offlineTime;

    @Generated(hash = 685160350)
    public BluDevice(Long id, String device_name, String device_address,
                     Date onlineTime, Date offlineTime) {
        this.id = id;
        this.device_name = device_name;
        this.device_address = device_address;
        this.onlineTime = onlineTime;
        this.offlineTime = offlineTime;
    }

    @Generated(hash = 1790239475)
    public BluDevice() {
    }

    public String getDevice_address() {
        return device_address;
    }

    public void setDevice_name(String device_name) {
        this.device_name = device_name;
    }

    public void setDevice_address(String device_address) {
        this.device_address = device_address;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDevice_name() {
        return this.device_name;
    }

    public Date getOnlineTime() {
        return this.onlineTime;
    }

    public void setOnlineTime(Date onlineTime) {
        this.onlineTime = onlineTime;
    }

    public Date getOfflineTime() {
        return this.offlineTime;
    }

    public void setOfflineTime(Date offlineTime) {
        this.offlineTime = offlineTime;
    }

    @Override
    public String toString() {
        // fixme 这里会报bug
        return  "id=" + id +
                ", 设备名=" + device_name +
                ", 设备地址=" + device_address +
                ", 上线时间=" + UIUtils.formatDate(onlineTime) +
                ", 下线时间=" + UIUtils.formatDate(offlineTime);
    }
}
